<?php include_once ('function/check_login_function.php'); include_once ('function/check_reminder_function.php'); onlyValid();?>
<!DOCTYPE html>
<html>
<head>
	<title>Calendar</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="">
</head>
<body>
	<div id="wrap">
		<header>
		</header>
		<div id="main">
			<div id="menu">
			</div>
			<div id="content">
					<form action="function/enter_reminder_function.php" method="POST">
					<?php 
						$time = date("Y-m-d H:i:s");
						$year = intval(date("Y"));
						$month = intval(date("m"));
						$day = intval(date("d"));
						$hour = intval(date("H"));
						$minute = intval(date("i"));
					?>
					
					<label for="hour">Time:</label>
					<select id="hour" name="hour">
					<?php 
						for ($i=0; $i<=23; $i++) {
							if ($i === $hour) {
								echo '<option value="'.$i.'" selected="selected">'.str_pad($i, 2, "0", STR_PAD_LEFT).'</option>';
							} else {
								echo '<option value="'.$i.'">'.str_pad($i, 2, "0", STR_PAD_LEFT).'</option>';
							}
						}
					?>
					</select>

					<select id="minute" name="minute">
					<?php 
						for ($i=0; $i<=59; $i++) {
							if ($i === $minute) {
								echo '<option value="'.$i.'" selected="selected">'.str_pad($i, 2, "0", STR_PAD_LEFT).'</option>';
							} else {
								echo '<option value="'.$i.'">'.str_pad($i, 2, "0", STR_PAD_LEFT).'</option>';
							}
						}
					?>
					</select>
					<br /> <br />
					<input type="radio" name="frequency" value="once" checked="checked" /> Once <br /> 
					<label for="day">Day:</label>
					<select id="day" name="day">
					<?php 
						for ($i=1; $i<=31; $i++) {
							if ($i === $day) {
								echo '<option value="'.$i.'" selected="selected">'.str_pad($i, 2, "0", STR_PAD_LEFT).'</option>';
							} else {
								echo '<option value="'.$i.'">'.str_pad($i, 2, "0", STR_PAD_LEFT).'</option>';
							}
						}
					?>
					</select>
					
					<label for="month">Month:</label>
					<select id="month" name="month">
					<?php 
						for ($i=1; $i<=12; $i++) {
							if ($i === $month) {
								echo '<option value="'.$i.'" selected="selected">'.str_pad($i, 2, "0", STR_PAD_LEFT).'</option>';
							} else {
								echo '<option value="'.$i.'">'.str_pad($i, 2, "0", STR_PAD_LEFT).'</option>';
							}
						}
					?>
					</select>	
					
					<label for="year">Year:</label>
					<select id="year" name="year">
					<?php for ($i=$year; $i<=2020; $i++) {echo '<option value="'.$i.'">'.$i.'</option>';}?>
					</select>  <br /><br />
					
					<input type="radio" name="frequency" value="every" /> Every <br/>
					<input type="checkbox" name="days[]" value="Monday" /> Mon
					<input type="checkbox" name="days[]" value="Tuesday" /> Tues
					<input type="checkbox" name="days[]" value="Wednesday" /> Wed
					<input type="checkbox" name="days[]" value="Thursday" /> Thur
					<input type="checkbox" name="days[]" value="Friday" /> Fri
					<input type="checkbox" name="days[]" value="Saturday" /> Sat
					<input type="checkbox" name="days[]" value="Sunday" /> Sun<br/>
					<textarea id="note" name="note" rows="4" cols="50"></textarea> <br />
					<input type="submit" name="remind" value="Remind" /> <br /> 
					</form>
	
					<hr />
					<?php 
					
						$reminder_list = $user->getReminderList();
						if ($reminder_list !== null) {
							echo '<ul>';
							foreach ($reminder_list as $reminder) {
								echo '<li>';
								echo $reminder['reminder_note'] . " - " . $reminder['reminder_time'] . " - " . $reminder['reminder_time_frequency'];
								echo '</li>';
							}
							echo '</ul>';
						}
					
					?>
			</div>
		</div>
		<footer>
			<div id="footer">
				
			</div>
		</footer>
	</div>
</body>